<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上传图片</title>
</head>
<body>
<h1>上传图片</h1>
<form id="form-upload" action="/upload" method="post" enctype="multipart/form-data">
    <p>请选择您要上传的文件<input type="file" name="image"></p>
    <p><input id="btn-upload" type="button" value="上传"></p>
</form>
<script src="jquery-3.4.1.min.js"></script>
<script>
    $('#btn-upload').click(function () {

        $.ajax({
            url:'/upload',
            type:'post',
            data:new FormData($('#form-upload')[0]),
            processData: false,
            contentType:false,
            success:function (result) {
                alert(result);
            }
        });
    });
</script>
</body>
</html>